package cn.com.dcsgo.api.client;

import cn.com.dcsgo.api.dto.ItemDTO;
import cn.com.dcsgo.api.dto.OrderDetailDTO;
import cn.com.dcsgo.api.fallback.ItemClientFallbackFactory;
import cn.com.dcsgo.config.DefaultFeignConfig;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Collection;
import java.util.List;

@FeignClient(value = "item-service",configuration = DefaultFeignConfig.class,fallbackFactory = ItemClientFallbackFactory.class)
public interface ItemClient {
    @GetMapping("/items")
    List<ItemDTO> queryItemsByIds(@RequestParam("ids") Collection<Long> ids);
    @PutMapping("/items/items/stock/deduct")
    public void deductStock(@RequestBody List<OrderDetailDTO> items);
    @PutMapping("/items/items/stock/add/")
    public void addStock(@RequestBody List<OrderDetailDTO> items);
    @GetMapping("/items/stock/{id}")
    public Integer getStockById(@PathVariable("id") Long id);
}